package com.yanqu.road.server.manger.config;

import com.yanqu.road.logic.bussiness.player.UserBeautyBussiness;
import com.yanqu.road.logic.config.GameConfig;
import com.yanqu.road.entity.enums.eSkillType;
import com.yanqu.road.entity.player.UserBeauty;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.BeautyModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;

import java.util.Map;

public class InteractiveMgr extends TempMgr {

    @Override
    public boolean init() throws Exception {
        return reload();
    }

    @Override
    public boolean reloadConfig() throws Exception {
        return true;
    }

    @Override
    public boolean stop() {
        return false;
    }

    @Override
    public boolean save() {
        return false;
    }

    @Override
    public boolean reloadData() {
        return true;
    }

    public static int getBeLikeLimit(long userId){
        GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
        int skillAddition;
        if(null == player){
            Map<Integer, UserBeauty> beautyMap = UserBeautyBussiness.getUserBeautyMap(userId);
            skillAddition = SkillMgr.getIdentitySkillAddition(beautyMap, eSkillType.BeLike.getValue(), 0);
        }else {
            skillAddition = player.getModule(BeautyModule.class).getIdentitySkillAddition(eSkillType.BeLike.getValue(), 0);
        }
        return GameConfig.HEART_MAX_COUNT + skillAddition / GameConfig.HEART_ADDITION_EFFECT;
    }

    public static int getBeHateLimit(){
        return -1 * GameConfig.HEART_MAX_COUNT;
    }
}
